'use strict';
function make_num_into_letter(item){
  let num1=item%26;
  let num2=Math.floor(item/26);
  if(num2==0){
   item=String.fromCharCode(num1+96);
  }
  else if(num2==1&&num1==0){
    item=String.fromCharCode(122);
  }
  else if(num2>1&&num1==0){
    item=String.fromCharCode(num2-1+96,122);
  }
  else{
    item=String.fromCharCode(num2+96,num1+96);
  }
return item;
}
function average_to_letter(collection) {
  let sum=collection.reduce(function(item1,item2){
    return item1+item2;
  });
  let average=Math.ceil(sum/collection.length);
  average=make_num_into_letter(average);
  console.log(average);
  return average;
}

module.exports = average_to_letter;
average_to_letter([1,2,3,4,5,6,7,8,9,10]);
